<template>
	<view class="uni-padding-wrap">
		<view class="content">
			<view class="selection">
				<view class="head">
					<view class="head_left">
						{{$t('Page.component.nbyx')}}
					</view>
					<view class="head_right">
						<view class="search">
							<uni-icons type="search" size="25" color="#2b333b"></uni-icons>
							<input class="uni-input input" placeholder="Search game" :value="inputClearValue"
								@input="clearInput" />
						</view>
						<view class="provide">
							<view class="sharearea">
								<view :class="['drawer' ,'line']" @click="getLanguages">
									<text class="line_last">{{$t('Page.component.gys')}}</text>
									<text :class=" ['triangle',rotate?'rotate':'']"></text>
								</view>
							</view>
							<view class="lange_box" v-show="rotate">
								<view class="">
									<checkbox-group class="lang_item" @change="checkboxChange">
										<label class="label" v-for="item in checkboxItems" :key="item.name">
											<view class="slot">
												<view>
													<checkbox :value="item.name" :checked="item.checked" color="#fff">
													</checkbox>
												</view>
												<view>{{item.value}}</view>
											</view>
											<text>Englist</text>
										</label>
									</checkbox-group>
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="slot_list">
					<view class="slot_item" v-for="item,index in 6" :key="'slot' + index">
						<view class="solt_shadow">
							<image src="/static/image/92928806952634624.jpg" class="solt_image" mode="aspectFit">
							</image>
							<view class="shadow">
								<uni-icons type="wallet" size="35" color="#fff"></uni-icons>
							</view>
						</view>
						<view>{{$t('Page.component.xyh')}} </view>
					</view>
				</view>
			</view>
			<view class="progress-box">
				<text>42/120</text>
				<view class="progress">
					<progress :percent="progress" show-info stroke-width="3" activeColor="#33c38f"
						backgroundColor="#000" />
				</view>
			</view>
			<view class="load">
				<button>{{$t('Page.home.jzgd')}}</button>
			</view>
			<view class="selection">
				<view class="more">
					<view class="slot">
						<uni-icons type="wallet" size="25" color="#fff"></uni-icons>
						<text>Slot</text>
					</view>
					<view>{{$t('Page.home.more')}} >>></view>
				</view>
				<view class="slot_list">
					<view class="slot_item " v-for="item,indexs in 6 " :key="'slot' + index">
						<view class="solt_shadow">
							<image src="/static/image/JILIgaming.avif" class="solt_image height"></image>
							<view class="shadow">
								<uni-icons type="wallet" size="35" color="#fff"></uni-icons>
							</view>
						</view>
						<view>{{$t('Page.component.xyh')}}</view>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				scrollTop: 0,
				old: {
					scrollTop: 0
				},
				rotate: false,
				checkboxItems: [{
						name: 'USA',
						value: '美国'
					},
					{
						name: 'CHN',
						value: '中国',
						checked: 'true'
					}
				],
				inputClearValue: '',
				progress: 40
			}
		},
		methods: {
			upper: function(e) {
				console.log(e)
			},
			lower: function(e) {
				console.log(e)
			},
			scroll: function(e) {
				console.log(e)
				this.old.scrollTop = e.detail.scrollTop
			},
			goTop: function(e) {
				// 解决view层不同步的问题
				this.scrollTop = this.old.scrollTop
				this.$nextTick(function() {
					this.scrollTop = 0
				});
				uni.showToast({
					icon: "none",
					title: "纵向滚动 scrollTop 值已被修改为 0"
				})
			},
			getLanguages() {
				this.rotate = !this.rotate
			},
			checkboxChange(e) {
				console.log(e)
				var checked = e.target.value
				var changed = {}
				for (var i = 0; i < this.checkboxItems.length; i++) {
					if (checked.indexOf(this.checkboxItems[i].name) !== -1) {
						changed['checkboxItems[' + i + '].checked'] = true
					} else {
						changed['checkboxItems[' + i + '].checked'] = false
					}
				}
			},
			clearInput: function(event) {
				this.inputClearValue = event.detail.value;
				// if (event.detail.value.length > 0) {
				// 	this.showClearIcon = true;
				// } else {
				// 	this.showClearIcon = false;
				// }
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		max-width: 1200px;
		margin: auto;
	}

	.head {
		display: flex;
		justify-content: space-between;
		color: #fff;
		margin-bottom: 22px;
	}

	.head_left {
		display: flex;
		align-items: center;
		font-size: 20px;
		font-weight: 700;
	}

	.head_right {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.search {
		display: flex;
		align-items: center;
		border-radius: 28px;
		height: 36px;
		background-color: #242a32;
		padding: 0 12px;
		color: #557086;
		border: 2px solid #2b333b;
	}

	.input {
		background-color: transparent;
		padding-left: 5px;
	}

	.provide {
		height: 36px;
		position: relative;
	}

	.sharearea {
		width: 140px;
		height: 36px;
		margin-left: 20px;
		/* position: absolute; */
		/* bottom: 0; */
		display: flex;
		/* margin: 16px; */
		/* #ifdef H5 */
		flex-flow: column;
		/* #endif */
		overflow: hidden;
		border-radius: 16px;
	}

	.drawer {
		box-shadow: 0px;
		border-radius: 12px;
		min-height: 36px;
		line-height: 36px;
		background: #20262d;
	}

	.line {
		color: #adadc2;
		display: flex;
		height: 36px;
		align-items: center;
		background-color: #2b333b;
		line-height: 20px;
		padding: 0px 18px;
		justify-content: space-between;
		flex-direction: row;
	}

	/* #ifdef H5 */
	.line:hover {
		background-color: #323b43;
		cursor: pointer;
	}

	/* #endif */

	.line_last {
		color: #fff;
	}

	.rotate {
		/* transform: rotateZ(180deg);
	margin-top: 0px; */
	}

	.triangle {
		display: inline-block;
		width: 0;
		height: 0;
		border: 5px solid transparent;
		border-left-color: #fff;
		transition: .5s all;
	}

	.lange_box {
		/* display: none; */
		width: 100%;
		transition: all 1s;
		top: 50px;
		right: 0;
		box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2), 0 2px 2px rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.12);
		overflow: hidden;
		background: #2b333b;
		color: #fff;
		border-radius: 10px;
		position: absolute;
		z-index: 9;
	}

	.lang_item {
		display: flex;
		flex-direction: column;
		cursor: pointer;
		color: #7c7c95;
		font-size: 13px;
	}

	.label {
		padding: 14px 16px;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.label:hover {
		background-color: #2D353D;
		color: #fff;
	}

	/deep/ uni-checkbox .uni-checkbox-input {
		border-color: #000;
		background: transparent;
	}

	/deep/ uni-checkbox .uni-checkbox-input:hover {
		border-color: #000;
	}

	/deep/ .uni-checkbox-input-checked {
		background: #33c38f !important;
		border-color: #33c38f !important;
	}

	.load {
		margin-top: 24px;
		color: #fff;
		height: 44px;
		line-height: 44px;
		display: flex;
		justify-content: center;

	}

	/deep/ uni-button {
		line-height: 44px;
		color: #fff;
		background: #2b333b;
		font-size: 14px;
	}

	/deep/ uni-button:hover {
		background: #484F56;
	}

	.more {
		height: 32px;
		margin-top: 24px;
		display: flex;
		justify-content: space-between;
		color: #fff;
	}

	.slot {
		display: flex;
		align-items: center;
	}

	.slot_list {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
		/* flex-wrap: wrap; */
		gap: 16px;
	}

	.slot_item {
		width: 100%;
		border-radius: 16px;
		color: #fff;
		/* margin-right: 30rpx; */
	}

	.solt_shadow {
		position: relative;
		border-radius: inherit;
		overflow: hidden;
		/* height: 240px; */
	}

	.solt_image {
		width: 100%;
		border-radius: inherit;
		transition: all .3s;
	}

	.shadow {
		opacity: 0;
		display: none;
	}

	/* #ifdef H5 */
	.solt_shadow:hover .solt_image {
		transform: scale(1.2);
	}

	.solt_shadow:hover .shadow {
		opacity: 1;
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
		background: rgba(0, 0, 0, 0.4);
		cursor: pointer;
		display: flex;
		align-items: center;
		justify-content: center;
		z-index: 1;
		border-radius: inherit;
	}

	/* #endif */

	.progress-box {
		display: flex;
		justify-content: center;
		margin-top: 24px;

		color: #fff;

	}

	.progress {
		width: 100px;
		margin-left: 10px;
	}

	/deep/ .uni-progress-info {
		font-size: 13px !important;
	}

	@media screen and (max-width: 768px) {
		.slot_list {
			display: grid;
			grid-template-columns: repeat(3, calc(33.3% - 10rpx));
			/* flex-wrap: wrap; */
			gap: 16rpx;
		}

		.solt_image {
			max-height: 260rpx !important;
		}

		.height {
			height: 60px !important;
		}

		.head {
			display: inherit;
		}

		.head_left {
			color: #33c38f;
		}

		.head_right {
			margin-top: 10px;
		}
	}

	.height {
		height: 80px;
	}
</style>